package com.elin4it.ssm.util;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * @Author:TY
 * @Descroption:
 * @Date: Created in 10:11 2018/4/9
 * @Modificd By:
 */
public class ApplicationContextUtil implements ApplicationContextAware{
    private static ApplicationContext applicationContext;
    public static  ApplicationContext getApplicationContext(){return applicationContext ;}
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
     ApplicationContextUtil.applicationContext=applicationContext;
    }
    public static Object gerBean(String beanName)
    {
        return applicationContext.getBean(beanName);
    }
}
